package com.ruanko.convert;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.struts2.util.StrutsTypeConverter;

import com.ruanko.entity.UserInfoBean;

public class UserInfoConvert extends StrutsTypeConverter   //这里要继承struts2提供的转换基类
{

	@Override
	public Object convertFromString(Map arg0, String[] arg1, Class arg2) {
		List<UserInfoBean> result = new ArrayList<UserInfoBean>();
		System.err.println("****"+"arg1::"+"**");
        for (int i = 0; i < arg1.length ; i++ )

        {
           UserInfoBean userInfoBean = new UserInfoBean();  //新建一个对象
           userInfoBean.setUserId(arg1[i]);   //依次将值保存到集合中
           i++;
           userInfoBean.setPwd(arg1[i]);
           i++;
           userInfoBean.setEmail(arg1[i]);
           result.add(userInfoBean);
        }
        return result;  
	}

	@Override
	public String convertToString(Map arg0, Object arg1) {
		// TODO Auto-generated method stub
		return null;
	}

}
